home *** CD-ROM | disk | FTP | other *** search
- head 1.5;
- branch ;
- access ;
- symbols ;
- locks ; strict;
- comment @ * @;
-
-
- 1.5
- date 92.03.27.13.41.19; author rab; state Exp;
- branches ;
- next 1.4;
-
- 1.4
- date 89.03.22.00.46.53; author rab; state Exp;
- branches ;
- next 1.3;
-
- 1.3
- date 88.07.25.14.15.30; author ouster; state Exp;
- branches ;
- next 1.2;
-
- 1.2
- date 88.07.14.09.46.19; author ouster; state Exp;
- branches ;
- next 1.1;
-
- 1.1
- date 88.05.21.14.46.05; author ouster; state Exp;
- branches ;
- next ;
-
-
- desc
- @@
-
-
- 1.5
- log
- @Added on_exit, and had to change atexit.c and exit.c to make local variables global.
- @
- text
- @/*
- * atexit.c --
- *
- * This file contains the source code for the "atexit" library
- * procedure.
- *
- * Copyright 1988 Regents of the University of California
- * Permission to use, copy, modify, and distribute this
- * software and its documentation for any purpose and without
- * fee is hereby granted, provided that the above copyright
- * notice appear in all copies. The University of California
- * makes no representations about the suitability of this
- * software for any purpose. It is provided "as is" without
- * express or implied warranty.
- */
-
- #ifndef lint
- static char rcsid[] = "$Header: /sprite/src/lib/c/stdlib/RCS/atexit.c,v 1.4 89/03/22 00:46:53 rab Exp Locker: rab $ SPRITE (Berkeley)";
- #endif /* not lint */
-
- #include <stdlib.h>
-
- /*
- * Variables shared with exit.c:
- */
-
- extern void (*_exitHandlers[])(); /* Function table. */
- extern int _exitNumHandlers; /* Number of functions currently
- * registered in table. */
- extern long _exitHandlerArgs[]; /* Arguments to pass to functions. */
- extern int _exitTableSize; /* Number of entries in table. */
-
- /*
- *----------------------------------------------------------------------
- *
- * atexit --
- *
- * Register a function ("func") to be called as part of process
- * exiting.
- *
- * Results:
- * The return value is 0 if the registration was successful,
- * and -1 if registration failed because the table was full.
- *
- * Side effects:
- * Information will be remembered so that when the process exits
- * (by calling the "exit" procedure), func will be called. Func
- * takes no arguments and returns no result. If the process
- * terminates in some way other than by calling exit, then func
- * will not be invoked.
- *
- *----------------------------------------------------------------------
- */
-
- int
- atexit(func)
- void (*func)(); /* Function to call during exit. */
- {
- if (_exitNumHandlers >= _exitTableSize) {
- return -1;
- }
- _exitHandlers[_exitNumHandlers] = func;
- _exitHandlerArgs[_exitNumHandlers] = 0;
- _exitNumHandlers += 1;
- return 0;
- }
- @
-
-
- 1.4
- log
- @*** empty log message ***
- @
- text
- @d18 1
- a18 1
- static char rcsid[] = "$Header: /sprite/src/lib/c/stdlib/RCS/atexit.c,v 1.3 88/07/25 14:15:30 ouster Exp Locker: rab $ SPRITE (Berkeley)";
- d27 2
- a28 2
- void (*_exitHandlers[32])(); /* Function table. */
- int _exitNumHandlers = 0; /* Number of functions currently
- d30 2
- a31 1
- int _exitTableSize = 32; /* Number of entries in table. */
- d63 1
- @
-
-
- 1.3
- log
- @Wasn't returning values correctly.
- @
- text
- @d18 4
- a21 2
- static char rcsid[] = "$Header: atexit.c,v 1.2 88/07/14 09:46:19 ouster Exp $ SPRITE (Berkeley)";
- #endif not lint
- @
-
-
- 1.2
- log
- @Move variables from exit.c to atexit.c, so that atexit can be
- used along with a private exit (as in csh).
- @
- text
- @d18 1
- a18 1
- static char rcsid[] = "$Header: atexit.c,v 1.1 88/05/21 14:46:05 ouster Exp $ SPRITE (Berkeley)";
- d40 1
- a40 1
- * and 1 if registration failed because the table was full.
- d57 1
- a57 1
- return 1;
- d61 1
- @
-
-
- 1.1
- log
- @Initial revision
- @
- text
- @d18 1
- a18 1
- static char rcsid[] = "$Header: proto.c,v 1.2 88/03/11 08:39:08 ouster Exp $ SPRITE (Berkeley)";
- d22 1
- a22 1
- * Variables shared from exit.c:
- d25 2
- a26 2
- extern void (*_exitHandlers[])(); /* Function table. */
- extern int _exitNumHandlers; /* Number of functions currently
- d28 1
- a28 1
- extern int _exitTableSize; /* Number of entries in table. */
- @
-